﻿using PSI.Helper;
using PSI.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PSI.Models;

namespace PSI.Controllers
{
    public class MainMenuAdminController : PSIBaseController
    {
        //
        // GET: /MainMenuAdmin/

        public ActionResult Index()
        {
            ViewBag.UserName = UserService.GetLoginUserName();
            return View();
        }

        [HttpPost]
        public ActionResult GetTreeItem() {

            var result = new MainMenuService().GetTreeItem();

            return Json(result);
        
        }

        [HttpPost]
        public ActionResult GetFidItem(string queryKey) {

            var result = new FIdService().GetFidList(queryKey);

            return Json(result);
        
        }

        [HttpPost]
        public ActionResult AddorEditMenuItem(MenuItem model) {

            var result = new MainMenuService().AddMenu(model);

            return Json(result);
        
        }

        [HttpPost]
        public ActionResult DelMenuItem(string id) {

            var result = new MainMenuService().DeleteMenu(id);

            return Json(result);
        
        }

    }
}
